package com.leo;

import com.almasb.fxgl.app.GameApplication;
import com.almasb.fxgl.app.GameSettings;
import com.almasb.fxgl.dsl.FXGL;
import com.almasb.fxgl.entity.SpawnData;
import com.leo.entity.CustomEntityFactory;

/**
 * @Author: wangss
 * @CreateTime: 2023-05-31  14:59
 * @Description: 创建实体的方式
 */
public class EntityApp extends GameApplication {
    @Override
    protected void initSettings(GameSettings settings) {

    }

    @Override
    protected void initGame() {
        FXGL.getGameWorld().addEntityFactory(new CustomEntityFactory());
        FXGL.spawn("rect", 20, 20);
        FXGL.spawn("square", new SpawnData(40, 40));
        FXGL.spawn("circle", new SpawnData(10, 70));

        SpawnData data = new SpawnData(100, 30);
        data.put("w", 100);
        data.put("h", 150);
    }

    public static void main(String[] args) {
        launch(args);
    }
}
